package com.neuedu.common;

//封装通用响应对象
public class ServerResponse<T> {
	private int status;//0 success, 1 error
	private String msg;//"xxxx成功"
	private T data;

	//添加、删除 (0，“添加成功”) (1,"删除失败")
	private ServerResponse(int status, String msg) {
		super();
		this.status = status;
		this.msg = msg;
	}
	private ServerResponse(int status, String msg, T data) {
		super();
		this.status = status;
		this.msg = msg;
		this.data = data;
	}
	
	public static<T> ServerResponse<T> createBySuccess(){
		return new ServerResponse<>(0, "SUCCESS");
	}
	public static<T> ServerResponse<T> createBySuccess(T data){
		return new ServerResponse<>(0, "SUCCESS",data);
	}
	
	
	public int getStatus() {
		return status;
	}
	public String getMsg() {
		return msg;
	}
	public T getData() {
		return data;
	}
}
